function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest(); //Not IE
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP"); //IE
	} else {
		alert("Your browser doesn't support the XmlHttpRequest object.  Better upgrade to Firefox.");
	}
}			
var receiveReq = getXmlHttpRequestObject();		
function isExisted(username) {
	var page = "../DB/isUserNameExist.jsp?username="+username;
	if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
		receiveReq.open("GET", page, true);
		receiveReq.onreadystatechange = handleSayHello;
		receiveReq.send(null);
	}
}
function handleSayHello() {
	if (receiveReq.readyState == 4) {
	    document.getElementById('isExist').innerHTML = receiveReq.responseText;
	    if (receiveReq.responseText.indexOf("Avai")>1)
		document.getElementById('isExist').style.color = 'blue';
        	else
		document.getElementById('isExist').style.color = 'red';
	    document.getElementById('isExist').style.fontWeight = 'bold';
	    document.getElementById('isExist').style.fontSize = '12px';
	    document.getElementById('isExist').innerHTML = receiveReq.responseText;
	}
}